Driving License OCR API
Objective
The Driving License OCR API verifies and extracts information from the user's Vietnamese Driving License.
| Input | Output |
|---|---|
| An image or PDF file containing a user's driving license | An array containing detailed information extracted from the document |
API Endpoint
readDL
Overview
The API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should upload all images and files as form-data through a POST request.
Authentication
You need a unique pair of application ID (appId) and application key (appKey) from HyperVerge to verify your identity for accessing the API.
API Request Details
Method - POST
Headers
| Parameter | Mandatory or Optional | Description | Allowed Values |
|---|---|---|---|
| content-type | Mandatory | This parameter defines the media type for the request payload | application/json |
| appId | Mandatory | The application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tab. | This should be a unique value |
| appKey | Mandatory | The application key shared by HyperVerge. You can find the details in the dashboard's credentials tab. | This should be a unique value |
| transactionId | Mandatory | A unique identifier for tracking a user journey | This should be both unique and easily associated with the user's journey in your application(s) |
Input
The following table provides the complete information on the parameter used in the request body for the API calls.
| Parameter | Description | Mandatory or Optional | Allowed Values | Default Value |
|---|---|---|---|---|
image | The parameter accepts either an image or a pdf file containing the national ID | Mandatory | Image(JPG,JPEG and PNG) or PDF File | Not Applicable |
Sample Request
The following code shows a standard cURL request for the API.
curl --location --request POST 'https://apac.docs.hyperverge.co/v1/readDL' \
--header 'Content-Type: multipart/form-data' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--form 'image=@"<path_to_image_file>"'
Success Response Sample
The following is a sample of a success response from the API.
{
"status": "success",
"statusCode": "200",
"result": [
{
"type": "dl_new_front",
"details": {
"name": {
"to-be-reviewed": "no",
"value": "<Name_of_the_User>",
"conf": 0.9946
},
"dob": {
"to-be-reviewed": "no",
"value": "<Date_Of_Birth_in_DD-MM-YYYY_Format>",
"conf": 0.9994
},
"dl-number": {
"to-be-reviewed": "no",
"value": "<Masked_Aadhaar_Number>",
"conf": 0.9925
}
"Other fields"
}
}
],
"requestId": "<Request_ID>"
}
Success Response Details
| Parameter | Type | Description |
|---|---|---|
| name | object | Details related to the name of the individual |
| to-be-reviewed | string | Indicates if the name is marked for review or not |
| value | string | The actual name value |
| conf | number | The confidence level associated with the accuracy of the name |
| dob | object | Details related to the date of birth of the individual |
| to-be-reviewed | string | Indicates if the date of birth is marked for review or not |
| value | string | The actual date of birth value |
| conf | number | The confidence level associated with the accuracy of the date of birth |
| dl-number | object | Details related to the driving license number |
| to-be-reviewed | string | Indicates if the driving license number is marked for review or not |
| value | string | The actual driving license number value |
| conf | number | The confidence level associated with the accuracy of the driving license number |
Failure Response Sample
The following is a sample response when no matching record is found against the input parameter.
{
"status": "failure",
"statusCode": 400,
"error": "API call requires atlest one input image"
}
Error Response Samples
- Driving License not Detected
- Rate Limit Exceeded
- Internal Server Error
{
"status": "failure",
"statusCode": 422,
"error": "Vietnam Driver License Not Detected",
"requestId": "<Request_ID>"
}
{
"status": "failure",
"statusCode": 429,
"error": "Rate limit exceeded"
}
The following is a sample response for a server error.
{
"message": "Internal Server Error",
"statusCode": 500,
"status": "failure"
}
Failure and Error Response Details
failure status, with a relavant status code and error message. The following table lists all error responses. | Status Code | Error Message | Error Description |
|---|---|---|
| 400 | API call handles only upto 2 images | This error is returned when more than 2 images are sent in the API call |
| 400 | image size cannot be greater than 6MB | The maximum size of input image is 6MB. Crossing this will result in this error |
| 422 | Vietnam Driver License Not Detected | When the AI model could not find a driving license in the image |
| 429 | Rate limit exceeded | You have exceeded the configured limit on the number of transactions permitted in a minute. Please contact the HyperVerge team for resolution |
| 500/501 | Internal Server Error | Please check the request headers or contact the HyperVerge team for resolution |
| 503 | Server busy | Please contact the HyperVerge team for resolution |